package com.zretc.controller;

import com.zretc.entity.Screening;
import com.zretc.service.FrontFilmDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Map;
/**
 * @author 周文涛
 * 前端页面电影详情控制层
 */
@Controller
@RequestMapping("front")
public class FrontFilmDetailsController {
    @Autowired
    private FrontFilmDetailsService frontFilmDetailsService;

    @GetMapping("film/{id}")
    @ResponseBody
    public Map<String , Object> getDetailsData(@PathVariable("id") String filmId){
        return frontFilmDetailsService.getFilmDetailPageData(Integer.valueOf(filmId));
    }

    @GetMapping("screening/{id}")
    @ResponseBody
    public Screening getScreeningDetails(@PathVariable("id") String screeningId){
        return frontFilmDetailsService.getScreeningDetail(Integer.valueOf(screeningId));
    }
}
